<%--
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
--%>
<%@ page contentType="text/html;charset=UTF-8"
  import="org.apache.commons.lang.StringEscapeUtils"
  import="org.apache.hadoop.conf.Configuration"
  import="com.alibaba.wasp.client.WaspAdmin"
        %>
<%@ page import="com.alibaba.wasp.master.FMaster" %>
<%@ page import="com.alibaba.wasp.meta.FTable" %>
<%
  FMaster master = (FMaster)getServletContext().getAttribute(FMaster.MASTER);
  Configuration conf = master.getConfiguration();
%>
<?xml version="1.0" encoding="UTF-8" ?>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Wasp Master: <%= master.getServerName() %></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">


    <link href="/static/css/bootstrap.css" rel="stylesheet">
    <link href="/static/css/wasp.css" rel="stylesheet">
    <link href="/static/css/bootstrap-responsive.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="/static/js/html5shiv.js"></script>
    <![endif]-->
  </head>

  <body>

    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="/master-status"><img src="/static/wasp_logo_small.jpg" alt="HBase Logo"/></a>
          <div class="nav-collapse">
            <ul class="nav">
                <li><a href="/master-status">Home</a></li>
                <li class="active"><a href="/tablesDetailed.jsp">Table Details</a></li>
                <li><a href="/logs/">Local logs</a></li>
                <li><a href="/logLevel">Log Level</a></li>
                <li><a href="/dump">Debug dump</a></li>
                <li><a href="/jmx">Metrics Dump</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container">
    <div class="row inner_header">
        <div class="page-header">
            <h1>User Tables</h1>
        </div>
    </div>

<% FTable[] tables = new WaspAdmin(conf).listTables();
   if(tables != null && tables.length > 0) { %>
<table class="table table-striped">
<tr>
    <th>Table</th>
    <th>Description</th>
</tr>
<%   for(FTable fTable : tables ) { %>
<tr>
    <td><a href="/table.jsp?name=<%= StringEscapeUtils.escapeXml(fTable.getTableName()) %>"><%= StringEscapeUtils.escapeXml(fTable.getTableName()) %></a></td>
    <td><%= StringEscapeUtils.escapeXml(fTable.toString()) %></td>
</tr>
<%   }  %>

<p> <%= tables.length %> table(s) in set.</p>
</table>
<% } %>
</div>
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>

</body>
</html>
